<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>gamvas.Animation</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.51 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="gamvas.Animation"></a>gamvas.<wbr>Animation</h1><div class=CBody><h4 class=CHeading>Description</h4><p>Class for animated sprites</p><p>The image for the animation is a JavaScript Image object, that holds all the frames with a certain width in one image.</p><p>For example, if you have a animation with 10 frames sized 64x64, you could make a image of 640x64 and put the 10 images side by side, or you could make 2 rows with 5 images on each and make a 320x128 image.</p><h4 class=CHeading>Constructor</h4><p>new gamvas.Animation(name, [image], [frameWidth], [frameHeight], [numberOfFrames], [fps]);</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>name</td><td class=CDLDescription>A unique identifier as name</td></tr><tr><td class=CDLEntry>image</td><td class=CDLDescription>A Image object that holds the frames of the animation (optional)</td></tr><tr><td class=CDLEntry>framwWidth</td><td class=CDLDescription>The width of a single frame (optional)</td></tr><tr><td class=CDLEntry>frameHeight</td><td class=CDLDescription>The height of a single frame (optional)</td></tr><tr><td class=CDLEntry>numberOfFrames</td><td class=CDLDescription>The number of frames the animation has (optional)</td></tr><tr><td class=CDLEntry>fps</td><td class=CDLDescription>The speed of the animation in frames per second (optional)</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#gamvas.Animation" >gamvas.<wbr>Animation</a></td><td class=SDescription>Class for animated sprites</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#gamvas.Animation.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.name" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">name</a></td><td class=SDescription>The name of the animation. </td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#gamvas.Animation.width" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">width</a></td><td class=SDescription>The width of a single frame in pixels</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.height" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">height</a></td><td class=SDescription>The height of a single frame in pixels</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#gamvas.Animation.numberOfFrames" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">numberOfFrames</a></td><td class=SDescription>The the frame count of the animation</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.currentFrame" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">currentFrame</a></td><td class=SDescription>The index of the current frame</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#gamvas.Animation.position" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">position</a></td><td class=SDescription>The current position as <a href="gamvas-vector2d-js.html#gamvas.Vector2D" class=LClass id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">gamvas.Vector2D</a></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.center" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">center</a></td><td class=SDescription>The center of rotation of the animation</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#gamvas.Animation.rotation" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">rotation</a></td><td class=SDescription>The rotation in radians</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.scaleFactor" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">scaleFactor</a></td><td class=SDescription>The scale factor (1 = not scaled, &lt; 1 = smaller, &gt; 1 = bigger)</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#gamvas.Animation.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.setFile" id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')">setFile</a></td><td class=SDescription>Sets a image as source of a animation</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.Animation.setFPS" id=link12 onMouseOver="ShowTip(event, 'tt12', 'link12')" onMouseOut="HideTip('tt12')">setFPS</a></td><td class=SDescription>Set the speed of the animation in frames per second</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.setRotation" id=link13 onMouseOver="ShowTip(event, 'tt13', 'link13')" onMouseOut="HideTip('tt13')">setRotation</a></td><td class=SDescription>Set certain rotation of the animation in radians</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.Animation.rotate" id=link14 onMouseOver="ShowTip(event, 'tt14', 'link14')" onMouseOut="HideTip('tt14')">rotate</a></td><td class=SDescription>Rotate the animation</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.setPosition" id=link15 onMouseOver="ShowTip(event, 'tt15', 'link15')" onMouseOut="HideTip('tt15')">setPosition</a></td><td class=SDescription>Set the position of a animation</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.Animation.move" id=link16 onMouseOver="ShowTip(event, 'tt16', 'link16')" onMouseOut="HideTip('tt16')">move</a></td><td class=SDescription>Move the animation</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.setScale" id=link17 onMouseOver="ShowTip(event, 'tt17', 'link17')" onMouseOut="HideTip('tt17')">setScale</a></td><td class=SDescription>Set a certain scale factor</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.Animation.scale" id=link18 onMouseOver="ShowTip(event, 'tt18', 'link18')" onMouseOut="HideTip('tt18')">scale</a></td><td class=SDescription>Scale the animation</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.setScaleXY" id=link19 onMouseOver="ShowTip(event, 'tt19', 'link19')" onMouseOut="HideTip('tt19')">setScaleXY</a></td><td class=SDescription>Set a different scale for x and y axis</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.Animation.setCenter" id=link20 onMouseOver="ShowTip(event, 'tt20', 'link20')" onMouseOut="HideTip('tt20')">setCenter</a></td><td class=SDescription>Set the center for an Animation. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.Animation.draw" id=link21 onMouseOver="ShowTip(event, 'tt21', 'link21')" onMouseOut="HideTip('tt21')">draw</a></td><td class=SDescription>Draw the animation according to its position, rotation and scale settings</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.Animation.setFrameList" id=link22 onMouseOver="ShowTip(event, 'tt22', 'link22')" onMouseOut="HideTip('tt22')">setFrameList</a></td><td class=SDescription>Allows to set a list of frames that are considdered to be the animation</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.Variables"></a>Variables</h3></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.name"></a>name</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.name</td></tr></table></blockquote><p>The name of the animation.&nbsp; Must be unique within all animations of a actor</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.width"></a>width</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.width</td></tr></table></blockquote><p>The width of a single frame in pixels</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.height"></a>height</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.height</td></tr></table></blockquote><p>The height of a single frame in pixels</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.numberOfFrames"></a>numberOfFrames</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.numberOfFrames</td></tr></table></blockquote><p>The the frame count of the animation</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.currentFrame"></a>currentFrame</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.currentFrame</td></tr></table></blockquote><p>The index of the current frame</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.position"></a>position</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.position</td></tr></table></blockquote><p>The current position as <a href="gamvas-vector2d-js.html#gamvas.Vector2D" class=LClass id=link23 onMouseOver="ShowTip(event, 'tt7', 'link23')" onMouseOut="HideTip('tt7')">gamvas.Vector2D</a></p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.center"></a>center</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.center</td></tr></table></blockquote><p>The center of rotation of the animation</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.rotation"></a>rotation</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.rotation</td></tr></table></blockquote><p>The rotation in radians</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.scaleFactor"></a>scaleFactor</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.scaleFactor</td></tr></table></blockquote><p>The scale factor (1 = not scaled, &lt; 1 = smaller, &gt; 1 = bigger)</p></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setFile"></a>setFile</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setFile: function(</td><td class="PParameter  prettyprint " nowrap>image,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>frameWidth,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>frameHeight,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>numberOfFrames,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>fps</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Sets a image as source of a animation</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>image</td><td class=CDLDescription>a JavaScript Image object holding the frames</td></tr><tr><td class=CDLEntry>frameWidth</td><td class=CDLDescription>the with of a single frame</td></tr><tr><td class=CDLEntry>frameHeight</td><td class=CDLDescription>the height of a single frame</td></tr><tr><td class=CDLEntry>numberOfFrames</td><td class=CDLDescription>the number of frames of the animation</td></tr><tr><td class=CDLEntry>fps</td><td class=CDLDescription>the speed of the animation in fps</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setFPS"></a>setFPS</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setFPS: function(</td><td class="PParameter  prettyprint " nowrap>fps</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Set the speed of the animation in frames per second</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>fps</td><td class=CDLDescription>The animation speed in frames per second</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setRotation"></a>setRotation</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setRotation: function(</td><td class="PParameter  prettyprint " nowrap>r</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Set certain rotation of the animation in radians</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>r</td><td class=CDLDescription>the rotation in radians</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.rotate" class=LFunction id=link24 onMouseOver="ShowTip(event, 'tt14', 'link24')" onMouseOut="HideTip('tt14')">gamvas.Animation.rotate</a> <a href="http://en.wikipedia.org/wiki/Radians" class=LURL target=_top>http://en.wikipedia.org/wiki/Radians</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.rotate"></a>rotate</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>rotate: function(</td><td class="PParameter  prettyprint " nowrap>r</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Rotate the animation</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>r</td><td class=CDLDescription>the amount to rotate the animation in radians</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.setRotation" class=LFunction id=link25 onMouseOver="ShowTip(event, 'tt13', 'link25')" onMouseOut="HideTip('tt13')">gamvas.Animation.setRotation</a> <a href="http://en.wikipedia.org/wiki/Radians" class=LURL target=_top>http://en.wikipedia.org/wiki/Radians</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setPosition"></a>setPosition</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setPosition: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Set the position of a animation</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>x/y</td><td class=CDLDescription>the position of the animation in pixels</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.move" class=LFunction id=link26 onMouseOver="ShowTip(event, 'tt16', 'link26')" onMouseOut="HideTip('tt16')">gamvas.Animation.move</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.move"></a>move</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>move: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Move the animation</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>x/y</td><td class=CDLDescription>the pixels to move the animation</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.setPosition" class=LFunction id=link27 onMouseOver="ShowTip(event, 'tt15', 'link27')" onMouseOut="HideTip('tt15')">gamvas.Animation.setPosition</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setScale"></a>setScale</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setScale: function(</td><td class="PParameter  prettyprint " nowrap>s</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Set a certain scale factor</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>s</td><td class=CDLDescription>the scale value (1 = no scale, &lt; 1 = smaller, &gt; 1 = bigger)</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.scale" class=LFunction id=link28 onMouseOver="ShowTip(event, 'tt18', 'link28')" onMouseOut="HideTip('tt18')">gamvas.Animation.scale</a> <a href="#gamvas.Animation.setScaleXY" class=LFunction id=link29 onMouseOver="ShowTip(event, 'tt19', 'link29')" onMouseOut="HideTip('tt19')">gamvas.Animation.setScaleXY</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.scale"></a>scale</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>scale: function(</td><td class="PParameter  prettyprint " nowrap>s</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Scale the animation</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>s</td><td class=CDLDescription>the scale factor (&lt; 0 = shrink, &gt; 0 = enlarge)</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.setScale" class=LFunction id=link30 onMouseOver="ShowTip(event, 'tt17', 'link30')" onMouseOut="HideTip('tt17')">gamvas.Animation.setScale</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setScaleXY"></a>setScaleXY</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setScaleXY: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Set a different scale for x and y axis</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>x</td><td class=CDLDescription>the scale of the x axis (1 = no scale, &lt; 1 = smaller, &gt; 1 = bigger)</td></tr><tr><td class=CDLEntry>y</td><td class=CDLDescription>the scale of the y axis (1 = no scale, &lt; 1 = smaller, &gt; 1 = bigger)</td></tr></table><h4 class=CHeading>See</h4><p><a href="#gamvas.Animation.setScale" class=LFunction id=link31 onMouseOver="ShowTip(event, 'tt17', 'link31')" onMouseOut="HideTip('tt17')">gamvas.Animation.setScale</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setCenter"></a>setCenter</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setCenter: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Set the center for an Animation.&nbsp; If you have a round object for example with a size of 64 by 64 pixels and you want to rotate it around the center, you would use myObject.setCenter(32, 32);</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>x/y</td><td class=CDLDescription>the center, as seen of the upper left corner of the object</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.draw"></a>draw</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>draw: function(</td><td class="PParameter  prettyprint " nowrap>t</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Draw the animation according to its position, rotation and scale settings</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>t</td><td class=CDLDescription>the time since last redraw</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.Animation.setFrameList"></a>setFrameList</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setFrameList: function(</td><td class="PParameter  prettyprint " nowrap>fl</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Allows to set a list of frames that are considdered to be the animation</p><p>Immagine a animation of a jumping ball, where on the first frame (0) it is squashed as it hits the ground, then jumps up, slows down and falls back down where it is squased again.</p><p>You would want to play the ground hitting frames fast, while you would want to play the slow down frames a bit slower, so assuming your animation had 5 frames, you would simple repeat * them, by setting a framelist of setFrameList([0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1]);</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>fl</td><td class=CDLDescription>a array of frame indexes for the animation</td></tr></table></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile><a href="gamvas-base-js.html">gamvas</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-actor-js.html">gamvas.<wbr>Actor</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-actorstate-js.html">gamvas.<wbr>ActorState</a></div></div><div class=MEntry><div class=MFile id=MSelected>gamvas.<wbr>Animation</div></div><div class=MEntry><div class=MFile><a href="gamvas-astar-js.html">gamvas.<wbr>AStar</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astargrid-js.html">gamvas.<wbr>AStarGrid</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astargridnode-js.html">gamvas.<wbr>AStarGridNode</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astarmap-js.html">gamvas.<wbr>AStarMap</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astarnode-js.html">gamvas.<wbr>AStarNode</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-camera-js.html">gamvas.<wbr>Camera</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-class-js.html">gamvas.<wbr>Class</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-config-js.html">gamvas.<wbr>config</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-dom-js.html">gamvas.dom</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-event-js.html">gamvas.<wbr>event</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-image-js.html">gamvas.<wbr>Image</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-key-js.html">gamvas.key</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-math-js.html">gamvas.math</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-mouse-js.html">gamvas.<wbr>mouse</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-particleemitter-js.html">gamvas.<wbr>ParticleEmitter</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-physics-js.html">gamvas.<wbr>physics</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-physics-userdata-js.html">gamvas.<wbr>physics.<wbr>UserData</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-rect-js.html">gamvas.Rect</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-resource-js.html">gamvas.<wbr>Resource</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-screen-js.html">gamvas.<wbr>screen</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-sound-js.html">gamvas.<wbr>Sound</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-state-js.html">gamvas.<wbr>state</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-state-state-js.html">gamvas.<wbr>State</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-timer-js.html">gamvas.<wbr>timer</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-vector2d-js.html">gamvas.<wbr>Vector2D</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Macros.html">Macros</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Functions">Functions</option><option value="Macros">Macros</option><option value="Variables">Variables</option></select></div><script language=JavaScript><!--
HideAllBut([], 2);// --></script></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.name</td></tr></table></blockquote>The name of the animation. </div></div><div class=CToolTip id="tt2"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.width</td></tr></table></blockquote>The width of a single frame in pixels</div></div><div class=CToolTip id="tt3"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.height</td></tr></table></blockquote>The height of a single frame in pixels</div></div><div class=CToolTip id="tt4"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.numberOfFrames</td></tr></table></blockquote>The the frame count of the animation</div></div><div class=CToolTip id="tt5"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.currentFrame</td></tr></table></blockquote>The index of the current frame</div></div><div class=CToolTip id="tt6"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.position</td></tr></table></blockquote>The current position as gamvas.Vector2D</div></div><div class=CToolTip id="tt7"><div class=CClass>A 2D vector class</div></div><div class=CToolTip id="tt8"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.center</td></tr></table></blockquote>The center of rotation of the animation</div></div><div class=CToolTip id="tt9"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.rotation</td></tr></table></blockquote>The rotation in radians</div></div><div class=CToolTip id="tt10"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">this.scaleFactor</td></tr></table></blockquote>The scale factor (1 = not scaled, &lt; 1 = smaller, &gt; 1 = bigger)</div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setFile: function(</td><td class="PParameter  prettyprint " nowrap>image,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>frameWidth,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>frameHeight,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>numberOfFrames,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>fps</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Sets a image as source of a animation</div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setFPS: function(</td><td class="PParameter  prettyprint " nowrap>fps</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Set the speed of the animation in frames per second</div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setRotation: function(</td><td class="PParameter  prettyprint " nowrap>r</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Set certain rotation of the animation in radians</div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>rotate: function(</td><td class="PParameter  prettyprint " nowrap>r</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Rotate the animation</div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setPosition: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Set the position of a animation</div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>move: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Move the animation</div></div><div class=CToolTip id="tt17"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setScale: function(</td><td class="PParameter  prettyprint " nowrap>s</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Set a certain scale factor</div></div><div class=CToolTip id="tt18"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>scale: function(</td><td class="PParameter  prettyprint " nowrap>s</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Scale the animation</div></div><div class=CToolTip id="tt19"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setScaleXY: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Set a different scale for x and y axis</div></div><div class=CToolTip id="tt20"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setCenter: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Set the center for an Animation. </div></div><div class=CToolTip id="tt21"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>draw: function(</td><td class="PParameter  prettyprint " nowrap>t</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Draw the animation according to its position, rotation and scale settings</div></div><div class=CToolTip id="tt22"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>setFrameList: function(</td><td class="PParameter  prettyprint " nowrap>fl</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Allows to set a list of frames that are considdered to be the animation</div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>